from GameObject import *
from Animation import *

class Flame(GameObject):

##############
# ANIMATIONS #
##############

    NUM_ANIMATIONS = 1
    FLAME = 0

    LEFT = NUM_ANIMATIONS

    ###############
    # FPS FACTORS #
    ###############
    FLAME_FPS_FACTOR = 10

    ##############
    # KEY FRAMES #
    ##############
    FLAME_KEY_FRAME = Animation.ALL_KEY_FRAMES

    ###################
    # ANIMATION TABLE #
    ###################
    ANIMATION_TABLE = [
        #FACING RIGHT
        (FLAME, 'Flame_Right', FLAME_FPS_FACTOR, FLAME_KEY_FRAME),

        #FACING LEFT
        (FLAME + LEFT, 'Flame_Left', FLAME_FPS_FACTOR, FLAME_KEY_FRAME),
        ]

    #############
    # MOVEMENTS #
    #############
    MOVEMENTS = [(0,0),   #FLAME
                 ]

    DEFAULT_ANIMATION = FLAME

##########
# SOUNDS #
##########
    NUM_SOUNDS = NUM_ANIMATIONS

    ###############
    # SOUND TABLE #
    ###############
    SOUND_TABLE = [(FLAME, 'Flame'),
                   ]
###########
# ATTACKS #    
###########
    FLAME_DAMAGE = 150

########
# MISC #
########
    DEFAULT_POSITION = (0,0)
    RECT_SIZE = (50,50)
    TICKS_TO_LIVE = 15

    
    def __init__(self):
        GameObject.__init__(self)
        self.ticksLeft = Flame.TICKS_TO_LIVE

    def update(self):
        self.ticksLeft -= 1
        if self.ticksLeft == 0:
            self.kill()
        else:
            self.animations[self.currentAnimation].update()
            GameObject.updateCurrentImage(self)

    def flame(self):
        self.currentAnimation = Flame.FLAME + self.facing
